package com.recharge.util;

import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.InitialContext;
import javax.sql.DataSource;

public class DBUtil {
	static DataSource ds;
	static{
    	try {
    		InitialContext ic=new InitialContext();
    		ds=(DataSource)ic.lookup("java:comp/env/myds");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
    	public static Connection getConnection() throws SQLException
    	{
    		Connection con=null;
    		if(ds!=null)
    		con=ds.getConnection();
    		else
    			throw new SQLException();
    	return con;	
    	}
	}

	
	


